home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 39 / CD-ROM 39 / CD-ROM 39.iso / COLORDIC / MOUSE / SCRNCAP.BAS < prev    next >
Encoding:
BASIC Source File  |  1996-01-19  |  1.5 KB  |  38 lines

  1. DefInt A-Z
  2.  
  3. Declare Sub ReleaseDC Lib "User" (ByVal hWnd, ByVal hDC)
  4. Declare Sub OpenClipBoard Lib "User" (ByVal hWnd)
  5. Declare Sub EmptyClipBoard Lib "User" ()
  6. Declare Sub SetClipBoardData Lib "User" (ByVal CBFormat, ByVal hBitMap)
  7. Declare Sub CloseClipBoard Lib "User" ()
  8. Declare Sub SelectObject Lib "GDI" (ByVal hDC, ByVal hObj)
  9. Declare Sub DeleteDC Lib "GDI" (ByVal hDC)
  10. Declare Function bitblt Lib "GDI" (ByVal DestDC, ByVal X, ByVal Y, ByVal BWidth, ByVal BHeight, ByVal SourceDC, ByVal X, ByVal Y, ByVal Constant&)
  11.  
  12. Declare Function CreateDC Lib "GDI" (ByVal Driver$, ByVal Dev&, ByVal O&, ByVal Init&)
  13. Declare Function CreateCompatibleDC Lib "GDI" (ByVal hDC)
  14. Declare Function CreateCompatibleBitmap Lib "GDI" (ByVal hDC, ByVal BWidth, ByVal BHeight)
  15.  
  16. Declare Function GetDC Lib "User" (ByVal hWnd As Integer) As Integer
  17.  
  18. Sub scrncap (Lt, Top, Rt, Bot)
  19.     rWidth = Rt - Lt
  20.     rHeight = Bot - Top
  21.     SourceDC = CreateDC("DISPLAY", 0, 0, 0)
  22.     a = GetDC(Pintura.Picture1.hDC)
  23.     DestDC = CreateCompatibleDC(SourceDC)
  24.     BHandle = CreateCompatibleBitmap(SourceDC, rWidth, rHeight)
  25.     SelectObject DestDC, BHandle
  26.     a = bitblt(DestDC, 0, 0, rWidth, rHeight, SourceDC, Lt, Top, &HCC0020)
  27.     'BitBlt a, 0, 0, 100, 100, BHandle, 0, 0, &HCC0020
  28.     Wnd = Screen.ActiveForm.hWnd
  29.     OpenClipBoard Wnd
  30.     EmptyClipBoard
  31.     SetClipBoardData 2, BHandle
  32.     CloseClipBoard
  33.     DeleteDC DestDC
  34.     ReleaseDC DHandle, SourceDC
  35.     'Picture1 = clipboard.GetData()
  36. End Sub
  37.  
  38.